//1. window对象:js脚本中定义全局对象、函数、变量在浏览器环境中自动成为window对象的属性
var a = 1;
document.writeln(`${a}<br>`);
window.document.writeln(`${window.a}<br>`);

document.writeln(`物理像素与CSS像素比例：${window.devicePixelRatio}<br>`);

document.writeln(`当前窗口可见尺寸：${window.innerWidth},${window.innerHeight}<br>`);
document.writeln(`当前窗口尺寸：${window.outerWidth},${window.outerHeight}<br>`);

// window.alert("提示对话框");  //通常使用时不需要window对象

// let inputAge = window.prompt("请输入年龄", 25);
// window.document.writeln(`${inputAge}<br>`);

// let isDelete = window.confirm("确认是否删除！");
// window.document.writeln(`是否删除：${isDelete}<br>`);

//2. window属性：location
document.writeln(`${window.location.href}<br>`);
// location.href = "http://www.jju.edu.cn";
// location.assign("http://www.jju.edu.cn");
// location.reload(true);  //刷新

//3. window属性：navigator对象
window.document.writeln(`用户代理：${window.navigator.userAgent}<br>`);
window.document.writeln(`系统平台：${window.navigator.platform}<br>`);
window.document.writeln(`语言环境：${window.navigator.language}<br>`);
window.navigator.geolocation.getCurrentPosition((pos) => {
    console.log(`${pos.coords.latitude},${pos.coords.longitude}`);
});

//4. window属性：history
// history.go(-1);   //回退到上一个历史

//5. window属性：screen对象
window.document.writeln(`窗口尺寸：${window.screen.width},${window.screen.height}<br>`);
window.document.writeln(`可用窗口尺寸：${window.screen.availWidth},${window.screen.availHeight}<br>`);
window.document.writeln(`窗口方向：${window.screen.orientation.type}<br>`);

//6. window属性：console对象
console.log("log");
console.info("info");
console.warn("warn");
console.debug("debug");
console.error("error");
console.dir({ key1: "v1", key2: "v2" });
console.table({ key1: "v1", key2: "v2" });